package com.lanchetech.bean.util;


import com.github.pagehelper.Page;
import com.lanchetech.bean.response.BasePageResp;
import com.lanchetech.bean.response.ResultData;

import java.util.List;

public class PageHelpUtil {


    public static <T> ResultData<BasePageResp<T>> buildPage(List<T> list, Page page) {
        ResultData<BasePageResp<T>> resultData = new ResultData<>();
        BasePageResp<T> basePageResp = new BasePageResp<>();
        basePageResp.setData(list);
        basePageResp.setPageNo(page.getPageNum());
        basePageResp.setPageSize(page.getPageSize());
        basePageResp.setTotal(page.getTotal());
        resultData.setValue(basePageResp);
        return resultData;
    }
}

